package com.qiankun.tang.ui.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.qiankun.tang.R;
import com.qiankun.tang.beans.ADBean;

/**
 * @author txf
 * @Title
 * @package com.qiankun.tang.ui.view
 * @date 2017/6/14 0014
 */

public class HorizontalListItemView extends LinearLayout {
    private SimpleDraweeView img;
    private TextView tvTitle;
    private TextView tvSubTitle;

    public HorizontalListItemView(Context context) {
        super(context);
        init();
    }
    public HorizontalListItemView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }
    public HorizontalListItemView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }
    private void init() {
        LayoutInflater.from(getContext()).inflate(R.layout.view_horizontallist, this);
        img = (SimpleDraweeView) findViewById(R.id.item_horizontallist_0_img);
        tvTitle = (TextView) findViewById(R.id.item_horizontallist_0_tvTitle);
        tvSubTitle = (TextView) findViewById(R.id.item_horizontallist_0_tvSubTitle);
    }
    public void setData(ADBean bean){
        img.setImageURI(bean.getImgUrl());
        tvTitle.setText(bean.getTvtitle());
        tvSubTitle.setText(bean.getTvsubtitle());
    }
}
